/**
 * Created by superxing-cto on 17/1/12.
 */
var currentUrl = location.href.split('#')[0];
$.get('/wx/getSignPackage', {url: currentUrl}, function (result) {
    if (result.status) {
        console.log(jQuery.parseJSON(result.data));
        wx.config(jQuery.parseJSON(result.data));
    } else {
        alert(result.message);
    }
});
/**
 * 微信分享方法
 * @param title
 * @param desc
 * @param link
 * @param imgUrl
 * @param callback
 */
function initShare(title, desc, link, imgUrl, callback) {
    wx.onMenuShareTimeline({
        title: desc,
        link: link,
        imgUrl: imgUrl,
        success: function () {
            if (callback) {
                callback.call();
            }
        }
    });
    wx.onMenuShareAppMessage({
        title: title,
        desc: desc,
        link: link,
        imgUrl: imgUrl,
        type: 'link',
        success: function () {
            if (callback) {
                callback.call();
            }
        }
    });
}
function initShareTimeline(title, link, imgUrl, callback) {
    wx.onMenuShareTimeline({
        title: title,
        link: link,
        imgUrl: imgUrl,
        success: function () {
            if (callback) {
                callback.call();
            }
        }
    });
}
function initShareAppMessage(title, desc, link, imgUrl, callback) {
    wx.onMenuShareAppMessage({
        title: title,
        desc: desc,
        link: link,
        imgUrl: imgUrl,
        type: 'link',
        success: function () {
            if (callback) {
                callback.call();
            }
        }
    });
}

function data_count(type, key) {
    $.get('/year/data_count', {type: type, key: key}, function (res) {

    });
}